const calculate = require('./calculate')
function calculateRanking(events, records) {
    let manEvent = []
    let womenEvent = []
    let allResult = calculate(events, records, false)
    // 过滤男性以及女性
    events.forEach(event => {
        if (String(event.gender) === '男子') {
            manEvent.push(event)
        } else {
            womenEvent.push(event)
        }
    })
    let manResult = calculate(manEvent, records, true)
    let womenResult = calculate(womenEvent, records, true)

    return {
        "men": manResult,
        "woman": womenResult,
        "all": allResult
    }
}
